---
- name: Ensure FUSE installed for using appimages.
  when: ansible_os_family == "Debian"
  become: true
  ansible.builtin.apt:
    state: latest
    name:
      - libfuse2

- name: Install latest neovim using AppImage
  when: ansible_distribution == 'Ubuntu'
  become: true
  ansible.builtin.get_url:
    url: https://github.com/neovim/neovim/releases/download/{{ nvim_version }}/nvim.appimage
    dest: /usr/local/bin/nvim
    mode: "0755"
    owner: "{{ user }}"
    force: true

- name: Install latest neovim for Arch Linux or Fedora
  when: ansible_os_family == 'Archlinux' or ansible_distribution == 'Fedora'
  become: true
  ansible.builtin.package:
    state: latest
    name: "{{ nvim_package_name }}"
